package com.sxt.springcloud.sys.fallback;

import com.sxt.springcloud.sys.LoginfoClientService;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;
import com.sxt.sys.vo.LoginfoVo;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class LoginfoClientFallbackService implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new LoginfoClientService() {
            @Override
            public DataGridView loadAllLoginfo(LoginfoVo loginfoVo) {
                return new DataGridView("服务降级，服务器忙，请稍后重试！调用查询所有日志方法失败");
            }

            @Override
            public ResultObj deleteLoginfo(Integer id) {
                return ResultObj.SERVER_BUSY;
            }

            @Override
            public ResultObj batchDeleteLoginfo(LoginfoVo loginfoVo) {
                return ResultObj.SERVER_BUSY;
            }
        };
    }
}
